package com.mikhailenko.transportMVC.repository.es;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.mikhailenko.transportMVC.model.es.BlockEntity;

public interface BlockRepository extends JpaRepository<BlockEntity, Integer>{

	@Query("SELECT block FROM blocks block WHERE block.name = :name ")
    BlockEntity findByName(@Param("name") String name);
	
	@Query("SELECT block FROM blocks block WHERE block.layer.id = :id ")
    List<BlockEntity> findByLayerId(@Param("id") int id);
}
